#ifndef WIDGETSCRIPTEDITOR_H
#define WIDGETSCRIPTEDITOR_H

#include <QWidget>
#include "utility/DocProcess.h"

namespace Ui {
class WidgetScriptEditor;
}

class WidgetScriptEditor : public QWidget
{
    Q_OBJECT

public:
    explicit WidgetScriptEditor(QWidget *parent = nullptr);
    ~WidgetScriptEditor();

public:
    /**
     * @brief 初始化脚本编辑器
     */
    void Initialize();
    /**
     * @brief 新增或修改GUI脚本
     * @param type
     * @param name
     * @param desc
     * @param evt
     */
    void EditGui(const QString& type, const QString& name, const QString& desc, const QString& evt);

signals:
    void sig_createGui();
    void sig_selectGui(const QString& name);

public slots:
    void loadScript(int index);
    void saveModify();

private slots:
    void on_customContextMenuRequested(const QPoint &pos);

    void on_btnRunLine_clicked();

    void on_btnRunAll_clicked();

    void on_btnZoomIn_clicked();

    void on_btnZoomOut_clicked();

    void on_btnGuiInsert_clicked();

private:
    Ui::WidgetScriptEditor *ui;
    bool _initialized;
    int _currentScriptIndex;
    DocProcess _docProcess;
};

#endif // WIDGETSCRIPTEDITOR_H
